//
//  FeedbackViewController.m
//  AnimationRecommend
//
//  Created by 花花蔡 on 2017/2/17.
//  Copyright © 2017年 ljm. All rights reserved.
//

#import "FeedbackViewController.h"
#import "MPTextView.h"

@interface FeedbackViewController ()

@end

@implementation FeedbackViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = NO;
    [self.navigationController.navigationBar setTintColor:[UIColor blackColor]];
    self.tabBarController.tabBar.hidden = YES;
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"反馈" style:UIBarButtonItemStyleDone target:self action:@selector(sendFeedbackMessage)];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    self.tabBarController.tabBar.hidden = NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor clearColor];
    UIImageView *imageV = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    imageV.image = [UIImage imageNamed:feedbackImageName];
    [self.view addSubview:imageV];
    [self setupTextView];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - 加载TextView
- (void)setupTextView {
    MPTextView *textView = [[MPTextView alloc] initWithFrame:AAdaptionRect(30, 84/AAdaptionWidth(), kBaseWidth - 60, 30/AAdaptionWidth())];
    textView.placeholderText = @"意见反馈";
    textView.backgroundColor = [UIColor clearColor];
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self.view addSubview:textView];
}

#pragma mark - 上传反馈信息
- (void)sendFeedbackMessage {
    
    __weak typeof(self) weakSelf = self;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        [CLLMessageBarTool showMessageWithType:TWMessageBarMessageTypeSuccess WithTitle:@"成功" WithDescription:@"已经反馈成功"];
        [weakSelf.navigationController popViewControllerAnimated:YES];
    });
    
}




@end
